package phylacterium.beans;

import java.util.ArrayList;

import phylacterium.entities.UserEntity;

public class RegisterBean {
	public ArrayList<String[]> genres = null;
	public ArrayList<String[]> education = null;
	public String loginError;
	public String passwordError;
	public UserEntity user;
	public String ageError;
	
	public RegisterBean(){
		loginError = new String();
		passwordError = new String();
		ageError = new String();
	}
	
	public RegisterBean(ArrayList<String[]> genres, ArrayList<String[]> education) {
		this();
		this.genres = genres;
		this.education = education;
	}
	
	public String writeLogin(){
		String text = new String();
		if (user != null)
			text = "value=\""+user.login+"\"";
		return text;
	}
	
	public String writeName(){
		String text = new String();
		if (user != null && user.name != null)
			text = "value=\""+user.name+"\"";
		return text;
	}
	
	public String writeAge(){
		String text = new String();
		if (user != null && user.ageField != null)
			text = "value=\""+user.ageField+"\"";
		return text;
	}
	
	public String writeGender(char gender){
		String text = new String();
		if (user != null && user.gender != null && user.gender == gender)
			text = "selected=\"selected\"";
		return text;
	}
	
	public String writeEducation(int number){
		String text = new String();
		if (user != null && user.education != null && user.education == number)
			text = "selected=\"selected\"";
		return text;
	}
	
	public String writeGenre(int number){
		String text = new String();
		if (user != null && user.favouriteGenre != null && user.favouriteGenre == number)
			text = "selected=\"selected\"";
		return text;
	}
}
